package com.yueyang.sojourn.server.model.enums;

import com.yueyang.sojourn.server.common.baymax.web.result.exception.StandardBusinessException;
import lombok.Getter;

import java.util.Optional;

/**
 * 分销员状态枚举
 * @author Stephen.Shi
 * @since 2020/05/03
 */
public enum ShareDistributorStatusEnum {
    已启用(1), 未启用(0)
    ;
    @Getter
    private int value;

    ShareDistributorStatusEnum(int value) {
        this.value = value;
    }

    public static Optional<ShareDistributorStatusEnum> findByValue(Integer status) {
        if (status != null) {
            for (ShareDistributorStatusEnum statusEnum: ShareDistributorStatusEnum.values()) {
                if (statusEnum.getValue() == status) {
                    return Optional.of(statusEnum);
                }
            }
        }
        return Optional.empty();
    }
}
